package org.xinjiang.data.migration.flush.enums;

import lombok.Getter;

/**
 * @author: 邢卫
 * @date: 2023年12月15日 13:39
 */
@Getter
public enum SexEnum {

    SEX_FEMALE(3, "2", "女", "SEX_FEMALE", "2"),
    SEX_MALE(2, "1", "男", "SEX_MALE", "1"),
    UNKNOWN(1, "0", "未知性别", "UNKNOWN", "UNKNOWN");

    private Integer id;

    private String code;

    private String name;

    //针对,司法所专职工作人员,派出所民警，公益性岗位，社工等转换
    private String sex;

    //针对用户数据
    private String value;

    SexEnum(Integer id, String code, String name, String value, String sex) {
        this.id = id;
        this.code = code;
        this.name = name;
        this.value = value;
        this.sex = sex;
    }

    public int getCodeInt() {
        return Integer.parseInt(code);
    }

    public static SexEnum value(String code) {
        for (SexEnum value : SexEnum.values()) {
            if (value.value.equals(code)) {
                return value;
            }
        }
        return UNKNOWN;
    }

    public static SexEnum sex(String sex) {
        for (SexEnum value : SexEnum.values()) {
            if (value.sex.equals(sex)) {
                return value;
            }
        }
        return UNKNOWN;
    }
}
